import { defineStore } from 'pinia'
import { $get } from '@/lib/plugin/Aegis'

export const commentStore = defineStore('comment', {
  state: () => {
    return {
      childrenPageSize: 2
    }
  },
  getters: {},
  actions: {
    async reply (payload:any) {
      try {
        const data = await $get('comment/create', {
          article_id: payload.article_id,
          content: payload.content,
          parent_comment_id: payload.parent_comment_id,
          to_user_id: payload.to_user_id
        })
        return Promise.resolve(data)
      } catch (error) {
        return Promise.reject(error)
      }
    }
  }
})
